<template>
  <div>
    <button @click="add">加法</button>
  </div>
</template>

<script>
import { EventBus } from "../../event-bus";
export default {
  name: "First",
  inject: ['name'],
  data() {
    return {
      count: 0
    };
  },
  methods: {
    add: function() {
      this.count = this.count + 1;
      // 通过EventBus.$emit发送事件
      EventBus.$emit("addition", {
        num: this.count
      });
      console.log(this.name, '0000');
    }
  }
};
</script>
